import React, { Component } from 'react';


class App extends Component {
  constructor() {
    super();
    this.state={todos:[]};
  }
  handleKeyDown=(event) => {
    
    if (event.keyCode==13) {
      let value=event.target.value;
      this.setState({todos:[...this.state.todos,value]});
    }
   
  }
  render() {
    return (
      <div className="App">
        <input type="text" onKeyDown={this.handleKeyDown}/>
        <ul>
          {
            this.state.todos.map(todo => <li>{todo}</li>)
          }
        </ul>
      </div>
    );
  }
}

export default App;
